// import { login as loginAPI } from "../../../services/modules/auth";
import { UserType } from "../../../services/modules/authType";
import * as actionTypes from "./constants";

import { Dispatch } from "redux";
// 模拟用户
import { loginUser } from "@/data/login";

export const login: any = (data: UserType) => {
  return (dispath: Dispatch) => {
    localStorage.setItem("token", loginUser.token);

    dispath({ type: actionTypes.SET_TOKEN, payload: loginUser.token });
    dispath({ type: actionTypes.SET_USER, payload: loginUser.userInfo });
  };
};
